const uniqid = (prefix, more_entropy) => {
    prefix = (typeof prefix == 'undefined') ? "" : prefix;
    var retId;
    var formatSeed = (seed, reqWidth) => {
        seed = parseInt(seed, 10).toString(16);
        if (reqWidth < seed.length) return seed.slice(seed.length - reqWidth);
        if (reqWidth > seed.length) return Array(1 + (reqWidth - seed.length)).join('0') + seed;
        return seed;
    };
    var uniqidSeed = Math.floor(Math.random() * 0x75bcd15);
    uniqidSeed++;
    retId = prefix;
    retId += formatSeed(parseInt(new Date().getTime() / 1000, 10), 8);
    retId += formatSeed(uniqidSeed, 5);
    if (more_entropy) retId += (Math.random() * 10).toFixed(8).toString();
    return retId;
};

module.exports = {
    uniqid: uniqid
};
